This sample code shows the use of the Window Object. Modify the following sample code to fit your needs.
Dim test As Index
Dim crwApplication As CRPEAuto.Application
Dim crystalreport As CRPEAuto.Report
Dim repView As CRPEAuto.View
Dim repWindow As CRPEAuto.Window
Private Sub Command1_Click()
'parent object that view belongs to (window)
Set crwApplication = CreateObject("Crystal.CRPE.Application")
Set crystalreport = crwApplication.OpenReport _
("c:\crw\reports\xtreme\wwsales.rpt")
Set repView = crystalreport.Preview
Set repWindow = repView.Parent
'test window to ensure it is referenced correctly
MsgBox "Window controls visible? " & repWindow.ControlsVisible
If MsgBox("Close window?", vbYesNo) = vbYes Then
repWindow.Close
End If
End Sub
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |